package com.example.admintor.threehome.fragment;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import com.example.admintor.threehome.activity.MainActivity;
import com.example.admintor.threehome.data.Datas;
import com.example.admintor.threehome.R;
import com.example.admintor.threehome.activity.LoginActivity;
import com.example.admintor.threehome.data.ReciveBean;
import com.example.admintor.threehome.data.ReciveDateHander;
import com.example.wzsdk.login.Landing;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Admintor on 2017/12/5.
 */

public class TwoFragment extends Fragment {
    @BindView(R.id.jin)
    ImageView jin;
    @BindView(R.id.stop)
    ImageView stop;
    @BindView(R.id.tui)
    ImageView tui;
    @BindView(R.id.star)
    Button star;
    private ReciveDateHander reciveDateHander;
    private Landing wzoneLanding;
    private boolean state;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_two, container, false);
        ButterKnife.bind(this, view);
        return view;
    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        reciveDateHander = ((MainActivity) activity).getReciveDateHander();
        wzoneLanding = reciveDateHander.getWzoneLanding();
    }


    @OnClick(R.id.jin)
    public void OnClickJin() {
        wzoneLanding.setKeyByUiid(Datas.Music, Datas.Music_JIN);
    }

    @OnClick(R.id.stop)
    public void OnClickStop() {
        if (state == false) {
            stop.setBackgroundResource(R.drawable.star);
            state = true;
        } else {
            stop.setBackgroundResource(R.drawable.stop);
            state = false;
        }
        wzoneLanding.setKeyByUiid(Datas.Music, Datas.Music_STAR_OR_STOP);
    }

    @OnClick(R.id.tui)
    public void OnClickTui() {
        wzoneLanding.setKeyByUiid(Datas.Music, Datas.Music_TUI);
    }

    @OnClick(R.id.star)
    public void OnClickStar() {
        wzoneLanding.setKeyByUiid(Datas.Music, Datas.Music_STAR_OR_STOP);
    }
}
